package com.flyllp.common.mail;

import java.util.Properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component("mail")
public class MailConfig
{
	private static final String FLAG_HOST = "mail.smtp.host";

	private static final String FLAG_PORT = "mail.smtp.port";

	private static final String FLAG_AUTH = "mail.smtp.auth";

	@Value("${mail.smtp.host}")
	private String mailServerHost;
	
	@Value("${mail.port}")
	private String mailServerPort;
	
	@Value("${mail.fromAddress}")
	private String fromAddress;
	
	@Value("${mail.fromAddress}")
	private String userName;
	
	@Value("${mail.password}")
	private String password;
	
	@Value("${mail.ssl}")
	private String validate;
	
	public Properties getProperties()
	{
		Properties p = new Properties();
		p.put(FLAG_HOST, this.mailServerHost);
		p.put(FLAG_PORT, this.mailServerPort);
		p.put(FLAG_AUTH, validate);
		return p;
	}

	public String getMailServerHost()
	{
		return mailServerHost;
	}

	public String getMailServerPort()
	{
		return mailServerPort;
	}

	public String getFromAddress()
	{
		return fromAddress;
	}

	public String getUserName()
	{
		return userName;
	}

	public String getPassword()
	{
		return password;
	}

	public String getValidate()
	{
		return validate;
	}
}